﻿Public Class frmMuestraProductos

    Private Sub txtBuscar_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBuscar.TextChanged
        bd.Inventario(cmbFiltro.SelectedItem, txtBuscar.Text, "frmMuestraProductos")
        dgvInventario.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
    End Sub

    Private Sub frmMuestraProductos_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        cmbFiltro.Items.Add("Codigo")
        cmbFiltro.Items.Add("Producto")

        cmbFiltro.SelectedIndex = 0


        bd.Inventario("", "", "frmMuestraProductos")
        dgvInventario.RowHeadersVisible = False
        dgvInventario.Columns(2).Visible = False
        dgvInventario.Columns(4).Visible = False
        dgvInventario.Columns(6).Visible = False
        dgvInventario.Columns(8).Visible = False
        dgvInventario.Columns(9).Visible = False

        dgvInventario.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill

        dgvInventario.ClearSelection()
    End Sub

    Private Sub dgvInventario_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvInventario.CellDoubleClick
        frmFacturacion.txtProducto.Text = dgvInventario.Item(0, dgvInventario.CurrentRow.Index).Value
        frmFacturacion.txtCantidad.Focus()
        Me.Close()
    End Sub


    Private Sub frmMuestraProductos_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Escape Then
            Me.Close()
        End If
    End Sub

    Private Sub cmbFiltro_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbFiltro.SelectedIndexChanged
        bd.Inventario(cmbFiltro.SelectedItem, txtBuscar.Text, "frmMuestraProductos")
    End Sub

End Class